package Login_Function;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

import JDBC.JDpoor;
import User_Utils.User;

public class Register {
	
	Connection con = new JDpoor().CreateCon();
	Statement sql = null;
	PreparedStatement pre = null;
	ResultSet rs = null;
	boolean f = false;
	
	public boolean register(User u) {
		String condition = "insert into user_info values(?,?,?,?)";
		
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, u.getName());
			pre.setString(2, u.getPhone());
			pre.setString(3, u.getEmail());
			pre.setString(4, u.getPassword());
			int t = pre.executeUpdate();
			if(t!=0)
	    		f = true;
	    	else
	    		f = false;
		} catch (Exception e) {
			System.out.println(e);
			f = false;
		}
		return f;
	}
	

}
